home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / SUBUNTIL.HDR < prev    next >
Text File  |  1994-04-25  |  2KB  |  68 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _SubUntil( cStr, cFromText, cToText ) --> cString
  8.  
  9. PARAMETERS:
  10.  
  11. cStr      : String to extract from
  12. cFromText : String after which to begin extracting cToText
  13. cToText   : String to stop extracting at when encountered
  14.  
  15. SHORT:
  16.  
  17. Return substring between two tokens in a string.
  18.  
  19. DESCRIPTION:
  20.  
  21. _SubUntil() takes an input string and begins extracting a string
  22. immediatly AFTER the cFromText label up to, but not including the
  23. cToText string.  It is useful for extracting a parameter or substring
  24. from another string when you do not know the exact position of the
  25. desired substring, only that it follows "some text" and ends at some
  26. text (most likely a white-space character).  _SubUntil() IS case sensitive.
  27.  If case is unknown, you should lower() or upper() the input strings.
  28.  
  29. An end of string condition will return the string from the requested start
  30. position up to the end of the string.
  31.  
  32. If cFromText is empty, the return string begins at the beginning of cStr
  33. (ie, the first character).
  34.  
  35. If cToText is empty, the return string includes everything from the
  36. starting position up to AND including the last character of cStr.
  37.  
  38. Thus, if both cFromText and cToText are empty (or NIL) then _SubUntil()
  39. will return the entire string.
  40.  
  41. RETURNS: Sub-String that occurs BETWEEN two delimiting strings.
  42.  
  43. NOTE:
  44.  
  45.  
  46.  
  47. EXAMPLE:
  48.  
  49. _SubUntil('Name: Kirby L. Wallace','Name: ',' ')
  50. Returns: "Kirby"
  51.  
  52. _SubUntil('Name: Kirby L. Wallace','L. ',' ')
  53. Returns: "Wallace" even though the cToText never occured
  54.  
  55. ? _SubUntil('Kirby L. Wallace',,'L.')
  56. Returns: "Kirby" (cToText defaulted to <beginning of string>)
  57.  
  58. ? _SubUntil('Kirby L. Wallace','Kirby','Wallace')
  59. Returns: " L. "  // note spaces!
  60.  
  61. ? _SubUntil('Kirby L. Wallace','L. ')  // Note SPACE in "L. "
  62. Returns: "Wallace"
  63.  
  64. ? _SubUntil('Kirby L. Wallace')
  65. Returns: "Kirby L. Wallace"
  66.  
  67. ******************************************************************************/
  68.